import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
import Layout from '@/components/MenuMain.vue'

const routes:Array<RouteRecordRaw> = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: '/dashboard',
      component: ()=>import('@/views/dashboard/Index.vue'),
      name: 'dashboard',
      meta: {
        title: '首页',
        icon: '#icondashboard'
      }
    }
    ]
  },
  {
    path: '/system',
    component: Layout,
    name: 'system',
    meta: {
      title: '系理',
      icon: 'Setting',
      roles: ["sys:manage"]
    },
    children: [{
      path: '/userList',
      component: ()=>import('@/views/system/User/UserList.vue'),
      name: 'userList',
      meta: {
        title: '管理',
        icon: 'UserFilled',
        roles: ["sys:user"]
      }
    },
    {
      path: '/roleList',
      component: ()=>import('@/views/system/Role/RoleList.vue'),
      name: 'roleList',
      meta: {
        title: '管理',
        icon: 'wallet',
        roles: ["sys:role"]
      }
    },
    {
      path: '/menuList',
      component: ()=>import('@/views/system/Menu/MenuList.vue'),
      name: 'MenuList',
      children: [{
        path: '/MenuTable',
        component: ()=>import('@/views/system/Menu/MenuTable.vue'),
        name: 'MenuTable',
        meta: {
          title: '管理',
          icon: 'UserFilled',
          roles: ["sys:user"]
        }
      },
      {
        path: '/MenuTable1',
        component: ()=>import('@/views/system/Menu/MenuTable1.vue'),
        name: 'MenuTable1',
        meta: {
          title: '管理',
          icon: 'UserFilled',
          roles: ["sys:user"]
        }
      }
    ],
      meta: {
        title: '管理',
        icon: 'Menu',
        roles: ["sys:menu"]
      }
    }
    ]
  },
  {
    path: '/goodsRoot',
    component: Layout,
    name: 'goodsRoot',
    meta: {
      title: '管理',
      icon: 'Setting',
      roles: ["sys:goodsRoot"]
    },
    children: [{
      path: '/category',
      component: ()=>import('@/views/category/CategoryList.vue'),
      name: 'category',
      meta: {
        title: '类型',
        icon: 'UserFilled',
        roles: ["sys:category"]
      }
    },
    {
      path: '/goodsList',
      component: ()=>import('@/views/goods/GoodsList.vue'),
      name: 'goodsList',
      meta: {
        title: '信息',
        icon: 'wallet',
        roles: ["sys:goodList"]
      }
    },
   
    ]
  }
];




const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;